<div class="bjui-pageContent">
    <table class="table table-bordered" data-toggle="datagrid" data-options="{
        height: '100%',
        gridTitle : '订单类型选择',
        showToolbar: false,
        toolbarItem: 'add',
            local: 'local',
            dataUrl: '/admin/order/createOrder',
            delPK: 'id',
            linenumberAll: true,
            sortAll: false,
            contextMenuH: true,
            contextMenuB: true,
            inlineEditMult: false,
            paging: {showPagenum:10, selectPageSize:'20,50,100', pageCurrent:1, pageSize:20},
            {{--showEditbtnscol: '操作',--}}
            customEditbtns: {width:200,position:'replace'},
            fullGrid: true,
            fieldSortable: false,
            filterThead: false,
            columnMenu: false,
        }">
        <thead>
        <tr>
            <th data-options="{name:'id',align:'center',width:100}">订单类型ID</th>
            <th data-options="{name:'title',align:'center',width:100}">标题</th>
            <th data-options="{name:'img_url', render:'get_img_by_path', align:'center',width:100}" data-toggle="webuploader">图片</th>
            <th data-options="{name:'process', edit:false, add:false, render:'get_process', align:'center',width:100}">流程</th>
            <th data-options="{name:'use_num',align:'center',width:100}">使用次数</th>
            <th data-options="{align:'center',width:200,render:process_manage}">管理</th>
        </tr>
        </thead>
    </table>
</div>
<script>
    function get_process(value, data){
        var html = '';
        $(value).each(function(){
            html += ('步骤'+this.pivot.step_number+':'+this.title+'<br>');
        })
        return html;
    }
    function process_manage(value, data){
        var html = '<button type="button" class="btn btn-info" data-toggle="navtab" data-options="{id:\'create_order_navtab\',fresh:true, url:\'/admin/order/orderTypeSubmit\', title:\'创建订单详情\', data:{order_type:' + data.id + '}}"><i class="fa fa-sitemap"></i>创建订单</button>';
        return html
    }
    function get_img_by_path(value){
        return '<img src="'+value+'" style="width:200px">';
    }
</script>
